<template>
  <div>
    <div class="header">
      <div class="title">公司</div>
      <van-search
        class="search"
        v-model="value"
        shape="round"
        background="#149639"
        placeholder="请输入搜索关键词"
      />
    </div>
    <section class="position-list">
      <CompanyComponent
        v-for="item in companyList"
        :key="item._id"
        :item="item"
      >
      </CompanyComponent>
    </section>
  </div>
</template>

<script>
import CompanyComponent from "@/components/CompanyComponent.vue";
export default {
  name: "CompanyView",
  components: {
    CompanyComponent,
  },
  data: () => {
    return {
      value: "",
      companyList: [],
    };
  },
  methods: {
    //获取公司列表
    getCompanyList() {
      this.axios.get("/v1/company/company-list").then((res) => {
        this.companyList = res.data.data.list;
      });
    },
  },
  created() {
    this.getCompanyList();
  },
};
</script>

<style lang="scss" scoped>
.header {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 100;
  height: 1rem;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #149639;
  box-sizing: border-box;
  padding: 0 0.3rem;
  .title {
    font-size: 0.36rem;
    color: #ffffff;
    margin-right: 0.2rem;
  }
  .search {
    flex-grow: 1;
    padding: 0;
  }
}
.position-list {
  text-align: left;
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  color: #333333;
  padding-bottom: 1.2rem;
}
</style>